package com.onec.service.gateway.service.system;

import com.onec.service.api.dto.request.RequestData;
import com.onec.service.api.dto.request.gateway.BizContent;
import com.onec.service.api.dto.response.ResponseData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ServerWebExchange;

/**
 * 机构鉴权
 *
 * @author onec
 * @see
 * @since 202021119
 */
@Service("AGENT")
public class AgentSourceService extends DefaultBaseSourceServiceImpl {


    private static final Logger logger = LoggerFactory.getLogger(AgentSourceService.class);

    /**
     * 解密机构上送的参数：同时验签：
     * md5 验签，rsa2 加解密：
     *
     * @param requestData requestData
     * @return RequestData
     */
    @Override
    public BizContent decryptRequestData(RequestData requestData, ServerWebExchange exchange) {
        return decryptAgentNo(requestData);
    }

    /**
     * 加密返回给下游的数据：同时签名
     *
     * @param responseData 服务返回明文
     * @return ResponseData  data:返回密文：
     */
    @Override
    public ResponseData encryptResponseData(ResponseData responseData) {
        return encryptAgentNo(responseData);
    }
}
